package com.byq.mm.common.engine.listener.filter;



import com.byq.mm.common.engine.Environment;

import org.jivesoftware.smack.packet.Stanza;

abstract public class AbstractFilter {
	AbstractFilter next;

	Environment env;
	public AbstractFilter(AbstractFilter n,Environment e) {
	
		this.next = n;
		this.env = e;
	}
	/**
	 * �����Ƿ��ϱ����
	 * @param data
	 * @return
	 */
	abstract protected boolean filt(Stanza data);

	public void process(Stanza arguments) {
		
		if (filt(arguments)) {
			myprocess(arguments);
			return;
		}
		if (next == null)
			return;
		next.process(arguments);

	}
	/**
	 * ���������
	 * @param data
	 * @return
	 */
	abstract protected void myprocess(Stanza data);
}
